package peer.tools;

public class ByteByteSwitch {
	
	public static void main(String [] args){
		short s=8;
		byte b=ByteByteSwitch.toByteArray(s);
		s=ByteByteSwitch.toShort(b);
		System.out.println(s);		
	}
	    public static byte toByteArray(short sh1) {
	    byte  bLocalArr = (byte)( sh1>>0 & 0xFF ); 
	    return bLocalArr; 
	    }

	    public static short toShort(byte b) { 
	        short iOutcome = 0; 
	        byte bLoop; 
	            bLoop = b; 
	            iOutcome+= (bLoop & 0xFF) << 0;   
	        return iOutcome; 
	    }    
	   }


